home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / pmake / top.mk < prev    next >
Encoding:
Text File  |  1992-04-14  |  3.5 KB  |  157 lines

  1. #
  2. # This is a library Makefile that is included by the Makefiles for
  3. # top-level directories.  This file just arranges for a variety of
  4. # targets to be passed on to each of a collection of subdirectories.
  5. # The file that includes this one should already have defined the
  6. # following variables:
  7. #    SUBDIRS        Subdirectories that contain "interesting" things
  8. #            (e.g., individual commands, modules of the kernel,
  9. #            of sub-portions of a large library).
  10. #
  11. # A bunch of variables are passed on to lower-level makes, if they are
  12. # defined;  see the definitions immediately below for a complete list.
  13. #    
  14. # $Header: /sprite/lib/pmake/RCS/top.mk,v 1.22 91/12/13 13:30:49 jhh Exp $
  15. #
  16.  
  17. #
  18. # System programs -- assign conditionally so they may be redefined in
  19. # including makefile
  20. #
  21. BINDIR        ?= /sprite/cmds.$(MACHINE)
  22.  
  23. CAT        ?= $(BINDIR)/cat
  24. CP        ?= $(BINDIR)/cp
  25. MV        ?= $(BINDIR)/mv
  26. RM        ?= $(BINDIR)/rm
  27. TEST            ?= $(BINDIR)/test
  28. UPDATE        ?= $(BINDIR)/update
  29.  
  30. #
  31. # Figure out what stuff we'll pass to sub-makes.
  32. #
  33. PASSVARS    =
  34. #ifdef        CC
  35. PASSVARS    += 'CC=$(CC)'
  36. #endif
  37. #ifdef        XCFLAGS
  38. PASSVARS    += 'XCFLAGS=$(XCFLAGS)'
  39. #endif
  40. #ifdef        XAFLAGS
  41. PASSVARS    += 'XAFLAGS=$(XAFLAGS)'
  42. #endif
  43. #ifdef        INCLUDEDIR
  44. PASSVARS    += 'INCLUDEDIR=$(INCLUDEDIR)'
  45. #endif
  46. #ifdef        INSTALLDIR
  47. PASSVARS    += 'INSTALLDIR=$(INSTALLDIR)'
  48. #endif
  49. #ifdef        NOBACKUP
  50. PASSVARS    += 'NOBACKUP=$(NOBACKUP)'
  51. #endif
  52. #ifdef        BACKUPAGE
  53. PASSVARS    += 'BACKUPAGE=$(BACKUPAGE)'
  54. #endif
  55. #ifdef        TM
  56. PASSVARS    += 'TM=$(TM)'
  57. #endif
  58.  
  59. # MAKESUBDIRS usage:
  60. #    <target> : MAKESUBDIRS
  61. #
  62. # This .USE target will simply pass <target> onto each subdirectory
  63. # in a separate make.  If the TM variable is defined, then only pass
  64. # the target on to subdirectories whose Makefiles include the given
  65. # TM among their MACHINES.
  66. #
  67. MAKESUBDIRS    : .USE .MAKE .SILENT .NOEXPORT
  68.     for i in $(SUBDIRS);
  69.     do
  70. #ifdef TM
  71.         if grep '^MACHINES' $i/Makefile | grep -s $(TM); then
  72.             true;
  73.         else continue;
  74.         fi
  75. #endif TM
  76.         echo %%% ${i} %%%
  77.         (cd $i; $(MAKE) $(PASSVARS) $(.TARGET))
  78.     done
  79.  
  80. default        : $(SUBDIRS) .NOEXPORT
  81.  
  82. #
  83. # Here as with MAKESUBDIRS, if an explicit TM is given then only
  84. # re-make in the subdirectories that support that particular target
  85. # machine.
  86. #
  87. $(SUBDIRS)    :: .SILENT .NOEXPORT
  88. #ifdef TM
  89.     if grep '^MACHINES' $(.TARGET)/Makefile | grep -s $(TM); then
  90.         (cd $(.TARGET); $(MAKE) $(PASSVARS))
  91.     else true;
  92.     fi
  93. #else
  94.     (cd $(.TARGET); $(MAKE) $(PASSVARS))
  95. #endif
  96.  
  97. clean        :: .NOEXPORT
  98.     rm -f *~
  99.  
  100. mkmf        ! .MAKE .SILENT .NOEXPORT
  101.     mkmf
  102.     for i in $(SUBDIRS);
  103.     do
  104.         echo  %%% ${i} %%%
  105.         (cd $i; $(MAKE) mkmf)
  106.     done
  107.  
  108. newtm        ! .MAKE .SILENT .NOEXPORT
  109.     for i in $(SUBDIRS);
  110.     do
  111.         echo %%% ${i} %%%
  112.         (cd $i; $(MAKE) $(PASSVARS) newtm)
  113.     done
  114.  
  115. rcsinfo        : .MAKE .SILENT .NOEXPORT
  116.     for i in $(SUBDIRS);
  117.     do
  118.         echo %%% ${i} %%%
  119.         (cd $i; rcsinfo)
  120.     done
  121.  
  122. dist ::   subdirs_d
  123. #if defined(DISTDIR) && !empty(DISTDIR)
  124.     for i in Makefile local.mk
  125.     do
  126.     if $(TEST) -e $${i};
  127.         then $(UPDATE)  $${i} $(DISTDIR)/$${i} ; else true; fi
  128.     done
  129. #endif
  130.  
  131. subdirs_d:
  132.     for i in $(SUBDIRS)
  133.     do
  134.         echo %%% $${i} %%%
  135. #if defined(DISTDIR) && !empty(DISTDIR)
  136. #ifdef TM
  137.         ( cd $${i}; $(MAKE) dist 'DISTDIR=$(DISTDIR)'/$${i} 'TM=$(TM)' )
  138. #else
  139.         ( cd $${i}; $(MAKE) dist 'DISTDIR=$(DISTDIR)'/$${i} )
  140. #endif
  141. #else
  142. #ifdef TM
  143.         ( cd $${i}; $(MAKE) dist 'TM=$(TM)' )
  144. #else
  145.         ( cd $${i}; $(MAKE) dist )
  146. #endif
  147. #endif
  148.     done
  149.  
  150. all clean tidy cleanall            :: MAKESUBDIRS
  151. debug depend dependall install        :: MAKESUBDIRS
  152. installhdrs installdebug installman    :: MAKESUBDIRS
  153. installprofile lint profile rdist    :: MAKESUBDIRS
  154. tags TAGS update snapshot        :: MAKESUBDIRS
  155.  
  156. .MAKEFLAGS    : -C        # No compatibility needed
  157.